<template>
  <el-main>
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item :to="{ path: '/' }">首页</el-breadcrumb-item>
      <el-breadcrumb-item>权限管理</el-breadcrumb-item>
      <el-breadcrumb-item>权限列表</el-breadcrumb-item>
    </el-breadcrumb>
    <el-table :data="state.tableData" style="width: 100%">
      <el-table-column type="index"  />
    <el-table-column prop="authName" label="权限名称" width="180" />
    <el-table-column prop="path" label="路径" width="180" />
    <el-table-column prop="level" label="层级" >
      <template #default="props" >
        <span v-if="props.row.level==0">一级</span>
        <span v-if="props.row.level==1">二级</span>
        <span v-if="props.row.level==2">三级</span>
      </template>
    </el-table-column>
  </el-table>

  </el-main>
</template>
<script>
import { defineComponent, onMounted, reactive, toRefs } from 'vue'
import { getRights} from "../../http/api.js";

export default {
  setup(){
    const  state=reactive({
      tableData:[]
    })
    onMounted(async ()=>{
      var res= await getRights("list");
      console.log(res)
      state.tableData=res;
    })
    return{
      state
    }
  }
}
</script>